<div class="row-content am-cf">
	<div class="row">
		<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
			<div class="widget am-cf">
				<div class="widget-head am-cf">
					<div class="widget-title am-fl">新增内容</div>
					<div class="widget-function am-fr">
						<a href="javascript:;" class="am-icon-cog"></a>
					</div>
				</div>
				<div class="widget-body am-fr">
					<form class="am-form tpl-form-line-form" id="newsForm" method="post" enctype="multipart/form-data">
						<div class="am-form-group">
							<label for="title" class="am-u-sm-2 am-form-label">标题
								<span class="tpl-form-line-small-title">Title</span>
							</label>
							<div class="am-u-sm-10">
								<input type="text" id="title" class="tpl-form-input" placeholder="请输入标题" name="title" /> 
							</div>
						</div>
						
						<!-- <div class="am-form-group">
							<label for="title" class="am-u-sm-2 am-form-label">所属部门
								<span class="tpl-form-line-small-title">Depart</span>
							</label>
							<div class="am-u-sm-10">
								<select id="depart" class="tpl-form-input" name="depart" >
									<option value="1">产业一部</option>
									<option value="2">产业二部</option>
									<option value="3">产业三部</option>
								</select> 
							</div>
						</div> -->
												
						<div class="am-form-group">
							<label for="type" class="am-u-sm-2 am-form-label">分类
								<span class="tpl-form-line-small-title">Type</span>
							</label>
							<div class="am-u-sm-10">
								<select id="type" data-am-selected="{searchBox: 1}"  name="typeId">
									<option>======产业一部======</option>
									<option th:each="type1 : ${type1}" 
									     th:value="${type1.id}" 
									     th:text="${type1.type}">
									</option>
									<option>======产业二部======</option>
									<option th:each="type2 : ${type2}" 
									     th:value="${type2.id}" 
									     th:text="${type2.type}">
									</option>
									<option>======产业三部======</option>
									<option th:each="type3 : ${type3}" 
									     th:value="${type3.id}" 
									     th:text="${type3.type}">
									</option>
								</select>
							</div>
						</div>						
						<div class="am-form-group">
							<label for="keyWords" class="am-u-sm-2 am-form-label">关键字
								<span class="tpl-form-line-small-title">KeyWord</span>
							</label>
							<div class="am-u-sm-10">
								<input type="text" id="keyWords" class="tpl-form-input" placeholder="请输入关键字" name="keyWords" /> 
							</div>
						</div>
						
						<div class="am-form-group">
							<label for="order" class="am-u-sm-2 am-form-label">序号
								<span class="tpl-form-line-small-title">Sort</span>
							</label>
							<div class="am-u-sm-10">
								<input type="text" id="sort" class="tpl-form-input" placeholder="数字越大排最前面" name="sort" /> 
							</div>
						</div>
						
						<div class="am-form-group">
							<label for="descs" class="am-u-sm-2 am-form-label">封面图
								<span class="tpl-form-line-small-title">Img</span>
							</label>
							<div class="am-u-sm-10">
								<input id="upFile" type="file"  />
								<input id="coverImg" type="hidden"   name="coverImg"/>
							</div>
						</div>
						
						<div class="am-form-group">
							<label for="photo" class="am-u-sm-2 am-form-label">其它图
								<span class="tpl-form-line-small-title">Photo</span>
							</label>
							<div class="am-u-sm-10">
								<input id="otherFile" type="file" multiple="multiple" />  
        						<!-- <input type="hidden" id="otherPhoto"  /> -->
        						<input type="hidden" name="otherPhoto" id="photovalue"  /> 
							</div>
						</div>
						
						<div class="am-form-group">
							<label  class="am-u-sm-2 am-form-label">视频
								<span class="tpl-form-line-small-title">Movie</span>
							</label>
							<div class="am-u-sm-10">
								<input id="movieFile" type="file" />
        						<!-- <input type="hidden" id="otherMovie"  /> -->
        						<input type="text" name="otherMovie" id="movievalue" />
							</div>
						</div>
						
					 <div class="am-form-group">
                          <label for="user-intro" class="am-u-sm-2 am-form-label">隐藏文章</label>
                          <div class="am-u-sm-10">
                              <div class="tpl-switch">
                                  <input type="checkbox" class="ios-switch bigswitch tpl-switch-btn am-margin-top-xs"  name="isShow"/>
                                  <div class="tpl-switch-btn-view">
                                      <div>
                                      </div>
                                  </div>
                              </div>
                      	 	</div>
                      </div>
					  <div class="am-form-group">
                            <label for="content" class="am-u-sm-2 am-form-label">文章内容</label>
                            <div class="am-u-sm-10 am-margin-top-xs">
                                <textarea class="" rows="10" id="content" name="content" placeholder="请输入文章内容"></textarea>
                                 <script>
                                editor = CKEDITOR.replace('content');
					            </script>
                            </div>
                        </div>
						<div class="am-form-group">
							<div class="am-u-sm-10 am-u-sm-push-2">
								
								<button type="button" onclick="return doSubmit();"
									class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
										<button type="button" onclick="loadPage('news/listUI')"
									class="am-btn am-btn-success tpl-btn-bg-color-success ">返回</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>

	</div>
	<script th:inline="javascript">
	<![CDATA[
	//$('select').selected();
		validateUserForm();
		var valdater;
		function validateUserForm(){ 
			valdater=$('#newsForm').validate({
		        errorElement : 'span',
		        errorClass : 'am-icon-times',
		        focusInvalid : true,
		        onkeyup:false,
		        ignore : "",
		        rules : {
		        	title : {
		                required : true
		            },
		            content : {
		                required : true
		            },
		            typeId : {
		            	required :true ,
		            	number : true
		            }
		        },
		        messages : {
		        	name : {
		                required : "请填写标题"
		            },
		            content : {
		                required : "请填写内容"
		            },
		            typeId : {
		            	required : "请选择分类"
		            }
		        }
		    });
		}
		
		function doSubmit(){
			CKEDITOR.instances.content.updateElement(); 
			 if(valdater.form()){
				commit('newsForm', 'news/save', 'news/listUI');
			  return true;
			 }
			  return false;
		}
		
		initUpFileOne('upFile','coverImg','添加封面图片','');
		
		initUpFileMore('otherFile','otherPhoto','添加其它图片','');
		
		initUpFileMovie('movieFile','otherMovie','添加视频','');
		]]>
	</script>